Skip to content

fix(datetime): set working parts to last selected value #29610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 30, 2025

Conversation

sean-perkins
Copy link
Contributor

@sean-perkins sean-perkins commented Jun 12, 2024

Issue number: resolves #29094


What is the current behavior?

When assigning multiple selected dates that span different months, the date time will not set the correct working parts and instead fallback to the default date: May 28, 2021.

What is the new behavior?

When opening the datetime with multiple dates selected, the calendar will animate to the last value in the array of selected dates.

If the datetime is collapsed, body is not visible, is not a grid view or the user has made a selection of a new date, the calendar will not animate and instead will set the working parts to the current value selected (latest/last value).

Does this introduce a breaking change?

  • Yes
  • No

Other information

Internally we discussed setting the month view to the first value in the array. Upon further investigation I determined this is not the expected behavior. When a user interacts with multiple date selection, the most recent selection (their active view) is the last value in the array. Animating or updating the working parts to the first value in the array would result in the calendar month jumping after every selection. Using the last index of the array results in no odd jumps in the experience. If a developer wishes to configure this behavior, they can change the order of the values in the value assigned to the datetime (to cause a specific month/date to be the initial view).

Dev build: 8.5.8-dev.11748388365.11ad9dfe

Copy link

vercel bot commented Jun 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ionic-framework ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 27, 2025 8:54pm

@github-actions github-actions bot added the package: core @ionic/core package label Jun 12, 2024
@sean-perkins sean-perkins changed the title fix(datetime): set working parts to first selected value fix(datetime): set working parts to last selected value Jun 12, 2024
@Keelback
Copy link

Keelback commented Jul 7, 2024

Hey... what is the current status? Need the fix:-)

@kemp
Copy link
Contributor

kemp commented Jul 30, 2024

@sean-perkins sorry for the ping, is this PR ready to be merged? Is there anything I can do to help (e.g. testing or dev)?

@Keelback
Copy link

Is there a timeline for fixing the bug? Or do you have a good workaround?

@ggroven
Copy link

ggroven commented Feb 6, 2025

hey, any update on this one? this is regression IMO because it was working correctly for me in previous versions

@thetaPC thetaPC marked this pull request as ready for review May 27, 2025 23:01
@thetaPC thetaPC requested a review from a team as a code owner May 27, 2025 23:01
@thetaPC thetaPC requested a review from christian-bromann May 27, 2025 23:01
Copy link
Member

@ShaneK ShaneK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Copy link
Member

@brandyscarney brandyscarney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀🌕

@thetaPC thetaPC added this pull request to the merge queue May 30, 2025
Merged via the queue into main with commit 14f32f8 May 30, 2025
61 checks passed
@thetaPC thetaPC deleted the sp/datetime-set-working-parts branch May 30, 2025 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: core @ionic/core package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: ion-datetime not accepting initial values across months when using with multiple option
7 participants